﻿using Max.PH4_2102A.Shopping.DAL;
using Max.PH4_2102A.Shopping.IRespository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Max.PH4_2102A.Shopping.Respository
{
    /// <summary>
    /// 工作单元的实现
    /// </summary>
    public class UnitOfWork : IUnitOfWork
    {

        EFCoreHelper _db;

        /// <summary>
        /// 构造函数注入
        /// </summary>
        /// <param name="db"></param>
        public UnitOfWork(EFCoreHelper db)
        {
            _db = db;
        }

        public EFCoreHelper GetDbContext()
        {
            return _db;
        }

        public int SaveChanges()
        {
            return _db.SaveChanges();
        }
    }
}
